Technical Field
The present invention relates to flash memory, and in particular to methods for garbage collection in a flash memory and apparatuses using the same.
Description of the Related Art
Flash memory devices typically include NOR flash devices and NAND flash devices. NOR flash devices are random access—a host accessing a NOR flash device can provide the device any address on its address pins and immediately retrieve data stored in that address on the device's data pins. NAND flash devices, on the other hand, are not random access but serial access. It is not possible for NAND to access any random address in the way described above. Instead, the host has to write into the device a sequence of bytes which identifies both the type of command requested (e.g. read, write, erase, etc.) and the address to be used for that command. The address identifies a page (the smallest chunk of flash memory that can be written in a single operation) or a block (the smallest chunk of flash memory that can be erased in a single operation), and not a single byte or word. In reality, the NAND flash device always reads complete pages from the memory cells and writes complete pages to the memory cells. After a page of data is read from the array into a buffer inside the device, the host can access the data bytes or words one by one by serially clocking them out using a strobe signal.
If the data in some of the pages of the blocks are no longer needed (these are also called stale pages), only the pages with good data in those blocks are read and re-programed into another previously erased empty block. Then the free blocks are available for new data after being erased. This is a process called GC (garbage collection). The process of GC involves reading and re-programming data to the flash memory. This means that a new re-program will first require a read of the whole block. However, performing GC this way consumes excessive time. Accordingly, what is needed are methods for GC in a flash memory and apparatuses using the same to reduce the access time.